home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 43.zip / Sources C- WorkDisk V.adf / ham.c < prev    next >
C/C++ Source or Header  |  1987-02-15  |  3KB  |  135 lines

  1. #include "exec/types.h"
  2. #include "intuition/intuition.h"
  3.  
  4. struct IntuitionBase *IntuitionBase;
  5. struct GfxBase *GfxBase;
  6.  
  7. struct Screen *Scrn;
  8. struct Window *NoBorder;
  9. struct RastPort *rp;
  10. struct ViewPort *vp;
  11.  
  12.  
  13. #define MODBLU 0x10
  14. #define MODRED 0x20
  15. #define MODGRN 0x30
  16.  
  17. struct NewScreen NewScrn =
  18. {
  19.  0,0,
  20.  320,200,6,
  21.  1,0,
  22.  HAM,
  23.  CUSTOMSCREEN,
  24.  NULL,                    /* Pointer to custom font */
  25.  NULL,                    /* Pointer to title text */
  26.  NULL,                    /* Pointer to screen gadgets */
  27.  NULL                     /* Pointer to custom bitmap */
  28. };
  29.  
  30. struct NewWindow NewNoBorder =
  31. {
  32.  0,0,
  33.  320,200,
  34.  0,0,
  35.  CLOSEWINDOW,             /*  IDCMP flags */
  36.  SMART_REFRESH | ACTIVATE | BORDERLESS | WINDOWCLOSE, /* flags */
  37.  NULL,                    /* Pointer to first gadget */
  38.  NULL,                    /* Pointer to Check Mark image */
  39.  NULL,                    /* Title */
  40.  NULL,                    /* Pointer to Screen structure */
  41.  NULL,                    /* Pointer to custom bitmap */
  42.  0,0,                     /* Min Width, Min Height */
  43.  0,0,                     /* Max Width, Max Height */     
  44.  CUSTOMSCREEN             /* Type of Screen this window resides on */
  45. };
  46.  
  47. main()
  48. {
  49.  
  50. OpenALL();
  51.  
  52. if((NewNoBorder.Screen = Scrn = (struct Screen *)OpenScreen(&NewScrn)) == NULL)
  53.  CloseALL();
  54.  
  55. if((NoBorder = (struct Window *)OpenWindow(&NewNoBorder)) == NULL)
  56.  CloseALL();
  57.  
  58. vp = (struct ViewPort *) ViewPortAddress(NoBorder);
  59. rp = NoBorder->RPort;
  60.  
  61. SetRGB4(vp,0,0,0,0);
  62. SetRGB4(vp,1,15,0,0);
  63. SetRGB4(vp,2,0,0,15);
  64. SetRGB4(vp,3,0,15,0);
  65.  
  66. drawham();
  67.  
  68. Wait(1 << NoBorder->UserPort->mp_SigBit);
  69.  
  70. CloseALL();
  71. }
  72.  
  73. OpenALL()
  74. {
  75.  if((IntuitionBase = (struct IntuitionBase *)
  76.      OpenLibrary("intuition.library",0)) == NULL) CloseALL();
  77.  
  78.  if((GfxBase = (struct GfxBase *)
  79.      OpenLibrary("graphics.library",0)) == NULL) CloseALL();
  80. }
  81.  
  82. CloseALL()
  83. {
  84.  if(NoBorder) CloseWindow(NoBorder);
  85.  if(Scrn) CloseScreen(Scrn);
  86.  if(GfxBase) CloseLibrary(GfxBase);
  87.  if(IntuitionBase) CloseLibrary(IntuitionBase);
  88.  exit(1);
  89. }
  90.  
  91. drawham()
  92. {
  93.  int c;
  94.  
  95.  for(c=0;c<32;c++)
  96.  {
  97.   SetAPen(rp,MODRED+c);
  98.   RectFill(rp,10*c,0,10*c+19,20-1);        
  99.   RectFill(rp,10*c,100,10*c+19,120-1);
  100.  
  101.   SetAPen(rp,MODBLU+c);
  102.   RectFill(rp,10*c,20,10*c+19,40-1);        
  103.   RectFill(rp,10*c,120,10*c+19,140-1);
  104.  
  105.   SetAPen(rp,MODRED+c);
  106.   RectFill(rp,10*c,40,10*c+19,60-1);        
  107.   RectFill(rp,10*c,140,10*c+19,160-1);
  108.  
  109.   SetAPen(rp,MODBLU+c);
  110.   RectFill(rp,10*c,60,10*c+19,80-1);        
  111.   RectFill(rp,10*c,160,10*c+19,180-1);
  112.  
  113.   SetAPen(rp,MODRED+c);
  114.   RectFill(rp,10*c,80,10*c+19,100-1);        
  115.   RectFill(rp,10*c,180,10*c+19,200-1);
  116.  }
  117.  
  118.  Delay(200);
  119.  
  120.  for(c=1;c<100;c++)
  121.  {
  122.   Delay(10);
  123.   SetAPen(rp,c);
  124.   Move(rp,0,0);Draw(rp,0,199);
  125.  }
  126.  
  127.  
  128. } /* end of Ham() */
  129.  
  130.  
  131.  
  132.  
  133.  
  134.         
  135.